"use strict"

/**
 * 南昌市政府采购网爬虫
 *  
 */

var Base = require("./base");
var nc_spider = new Base();
nc_spider.name = "南昌市政府采购网";
nc_spider.contentType = "text";
nc_spider.encode = "utf-8";

nc_spider.getPageUrl = function(pg) {
    return "http://www.ncszfcg.gov.cn/more.cfm?sid=100002003&Page=" + pg;
};

nc_spider.getItems = function(data) {
    var items = [];
    var reg = new RegExp("td title=\"(.*?)\".*?href=\"(.*?)\"", "ig");
    var regv;
    while (regv = reg.exec(data)) {
        var id = regv[2];
        var title = regv[1];
        var item = {};
        item.title = title;
        item.url = "http://www.ncszfcg.gov.cn/" + id;
        item.source = nc_spider.name;
        items.push(item);
    }
    return items;
};

exports = module.exports = nc_spider;
